package com.ordertracker.endpoint;

import com.ordertracker.dao.DAO;
import com.sun.jersey.spi.container.ContainerRequest;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.annotation.security.RolesAllowed;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.*;
import java.util.List;
import java.util.Map;

/**
 * Description of class.
 * Created 11/19/12 4:22 PM
 *
 * @author andrey.rodin@playtech.com
 */

@Component
@Path("/service")
public class RestEntryPoint {


    private DAO dao;

    @Resource
    public void setDao(DAO dao) {
        this.dao = dao;
    }

    @GET
    @Path("/helloworld")
//    @RolesAllowed({"Test"})
    public Response getHelloWorld(@Context Request request, @Context UriInfo uriInfo) {
        MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();

        List<String> authorization = ((ContainerRequest) request).getRequestHeaders().get("authorization");

        String hello = dao.getHello();
        return Response.status(200).entity(hello).build();
    }
}
